package com.pro.springbootshop.controller;

import com.pro.springbootshop.entity.Seller;
import com.pro.springbootshop.service.SellerService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class SellerController {
    @Autowired
    SellerService sellerService;
    @ApiOperation("商家登录")
    @PostMapping("/api/seller/login")
    public String loginSeller(@RequestBody Seller seller){
        return sellerService.loginSeller(seller);
    }
    @ApiOperation("获取商家信息")
    @GetMapping("/api/seller/{token}")
    public Map<String, String> getSeller(@PathVariable(name = "token") String token){
        return sellerService.getSeller(token);
    }
    @ApiOperation("商家注册")
    @PostMapping("/api/seller/register")
    public String insertSeller(@RequestBody Seller seller){ return  sellerService.insertSeller(seller); }
}
